﻿using Engine;
using Game;

namespace Mekiasm
{
    public class PrecisionSawmillWidget : BaseEnergyWidget
    {
        public ComponentPrecisionSawmill generator;
        public PrecisionSawmillWidget(ComponentPrecisionSawmill componentCoalGenerator, ComponentMiner componentMiner) : base(componentMiner)
        {
            generator = componentCoalGenerator;
            MekCraftingRecipe.FindCraftDevice(typeof(PrecisionSawmill)).GenerateRecipeWidget(CanvasMain, componentCoalGenerator, componentMiner, ref Tick);
            setTitle("精密锯木机");
        }

        public override void Update()
        {
            Tick?.Invoke();
            SetPowerProgress((float)generator.Power / (float)generator.MaxPower);
            SetLeftBottomMoreInfo($"消耗:{ILibrary.FormatPower(generator.OutputPowerLimit)}\n当前储能:{ILibrary.FormatPower(generator.Power)}\n最大:{ILibrary.FormatPower(generator.MaxPower)}");
        }

    }
}
